package com.example.gradle_test_css.server.serverImpl;

import com.evn.base.pojo.ClauseMap;
import com.evn.base.pojo.OrClauseMap;
import com.evn.base.pojo.PageResult;
import com.evn.base.pojo.QueryModel;
import com.evn.base.repository.DtoHelper;
import com.example.gradle_test_css.Entity.datainfo;
import com.example.gradle_test_css.pojo.datainfoDTO;
import com.example.gradle_test_css.repository.datainfoRepository;
import com.example.gradle_test_css.server.datainfoServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Service
public class datainfoServerImpl implements datainfoServer {
    @Autowired
    private datainfoRepository datainfoRepository;

    @Override
    public List<datainfo> datainfoList() {
        return null;
    }

    @Override
    public PageResult<datainfoDTO> finddatainfo(QueryModel queryModel) {
        Page<datainfo> page = datainfoRepository.findAll(queryModel);
        List<datainfoDTO> ts = DtoHelper.entityListToDtoList(page.getContent(), datainfoDTO.class);
        return new PageResult<>(ts, page.getTotalElements());
    }
}
